﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace linkouqs.Gamekit {

    public static class CharacterController2DExtensions {

        public static bool IsPressedJump(this CharacterController2D character) {
            return character.CharacterInput && character.CharacterInput.IsPressedJump;
        }

        public static bool IsPressedRun(this CharacterController2D character) {
            return character.CharacterInput && character.CharacterInput.IsPressedRun;
        }


        public static bool IsPressedRunLeft(this CharacterController2D character) {
            return character.CharacterInput && character.CharacterInput.IsPressedRunLeft;
        }


        public static bool IsPressedRunRight(this CharacterController2D character) {
            return character.CharacterInput && character.CharacterInput.IsPressedRunRight;
        }


        public static bool IsPressedAction(this CharacterController2D character) {
            return character.CharacterInput && character.CharacterInput.IsPressedAction;
        }


        public static bool IsFaceTo(this CharacterController2D character, Transform other) {
            if (character.IsLeft) {
                return character.transform.position.x > other.position.x;
            }
            return character.transform.position.x < other.position.x;
        }

    }

}
